<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input type="text" id="year" value="">
  <button id="btn">提交</button>
  <script>
    // 判断平年闰年
    document.getElementById('btn').onclick = function () {
      var a = parseInt(document.getElementById('year').value);
      a % 4 == 0 && a % 100 != 0 || a % 400 == 0 ? alert("这是闰年") : alert('这是平年');
    }
  </script>
</body>

</html>